package csu.rjxyg.action.userAction;

import csu.rjxyg.action.BaseAction;
import csu.rjxyg.bean.core.BaseObject;
import csu.rjxyg.action.constant.UserConstant;
import csu.rjxyg.factory.core.UtilFactory;
import csu.rjxyg.util.LogUtil;

public class LogoutAction extends BaseAction {
	private LogUtil log;	
	
	public LogoutAction(){
		log = UtilFactory.getLogUtil(getClass());
	}
	
	public String logout(){
		BaseObject temp = (BaseObject) this.getSession().get(UserConstant.USER_SESSION);
		try{
			this.getSession().clear();
			log.info(temp.get(UserConstant.USER_ID) + "退出系统成功");
			return BaseAction.SUCCESS;
		}catch(Exception e){
			e.printStackTrace();
			log.info(e.getMessage());
		}
		log.info(temp.get(UserConstant.USER_ID) + "退出系统出现异常");
		return BaseAction.FAIL;
	}
}
